import { Map } from 'immutable'
import * as actionTypes from './constants'
const defaultState = Map({
  toplist: [],
  currentIndex:0,
  currentToplistDetail:{}
})

export default function reducer(state = defaultState, action) {
  switch (action.type) {
    case actionTypes.CHANGE_TOPLIST_ACTION:
      return state.set('toplist', action.toplist)
    case actionTypes.CHANGE_CURRENT_INDEX_ACTION:
      return state.set('currentIndex', action.currentIndex)
    case actionTypes.CHANGE_CURRENT_TOPLIST_DETAIL:
      return state.set('currentToplistDetail',action.currentToplistDetail)
    default:
      return state
  }
 }
